// 装饰器执行顺序
// 属性》方法》方法参数》类

// 如果有多个同样的装饰器，它会先执行后面的

namespace Log{
  function logClass1(params: string) {
    return function(target: any) {
      console.log('类装饰器1')
    }
  }
  function logClass2(params: string) {
    return function(target: any) {
      console.log('类装饰器2')
    }
  }
  function logAttribute(params?: string) {
    return function(target: any, attrName: any) {
      console.log('属性装饰器')
    }
  }
  function logMethod(params?: string) {
    return function(target: any, attrName: any) {
      console.log('方法装饰器')
    }
  }
  function logParams1(params?: string) {
    return function(target: any, attrName: any, desc: any) {
      console.log('方法参数装饰器1')
    }
  }
  function logParams2(params?: string) {
    return function(target: any, attrName: any,  desc: any) {
      console.log('方法参数装饰器2')
    }
  }

  @logClass1('http://www.itying.com/api')
  @logClass2('xxxx')
  class HttpClient{
    constructor() {

    }
    @logAttribute()
    public apiUrl: string | undefined;
    @logMethod()
    getData() {
      return true;
    }
    setData(@logParams1() attr1: any, @logParams2() attr2: any,) {

    }
  }
  var http:any = new HttpClient();
  console.log(http.apiUrl)

}


